package cn.itheima_03;

import java.util.ArrayList;
import java.util.Collections;

/*具体规则：
1. 组装54张扑克牌
2. 将54张牌顺序打乱
3. 三个玩家参与游戏，三人交替摸牌，每人17张牌，最后三张留作底牌。
4. 查看三人各自手中的牌、底牌*/
public class Test_05 {
	public static void main(String[] args) {
		//组装54张扑克牌
		String[] s={"♥","♠","♣","♦"};
		String[] ss={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
		//创建集合
		ArrayList<String> array=new ArrayList<String>();
		//组装54张扑克牌,并存入集合
		for (int i = 0; i < s.length; i++) {
			
			for (int j = 0; j < ss.length; j++) {
				array.add(s[i]+ss[j]);
			}
	}
		//存入大小王
		array.add("大王");
		array.add("小王");
		//将54张牌顺序打乱
		Collections.shuffle(array);
		//三个玩家参与游戏，三人交替摸牌，每人17张牌，最后三张留作底牌。
		ArrayList<String> leik=new ArrayList<String>(); 
		ArrayList<String> wangx=new ArrayList<String>();
		ArrayList<String> Longl=new ArrayList<String>();
		//发牌
		for (int i = 0; i < array.size()-3; i++) {
			if(i%3==0){
				leik.add(array.get(i));
			}else if(i%3==1){
				wangx.add(array.get(i));
			}else{
				Longl.add(array.get(i));
			}
		}
		System.out.println("leik:"+leik);
		System.out.println("wangx:"+wangx);
		System.out.println("Longl:"+Longl);
		//底牌
		System.out.print("底牌:");
		for (int i = array.size()-3; i <array.size(); i++) {
			System.out.print(array.get(i)+" ");
		}
		
}
}